package com.techsoul.module.file.config;

import com.aliyun.oss.OSSClient;
import com.techsoul.module.file.config.properties.AliyunOssProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties(AliyunOssProperties.class)
public class AliyunOssConfig {

    @Autowired
    private AliyunOssProperties aliyunOssProperties;

    @Bean
    public OSSClient ossClient() {
        return new OSSClient(aliyunOssProperties.getEndPoint(), aliyunOssProperties.getAccessKeyId(), aliyunOssProperties.getSecretAccessKey());
    }

}
